package cn.tedu.backend.portal.controller;

import cn.tedu.backend.portal.model.UserActivity;
import cn.tedu.backend.portal.service.IUserActivityService;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
public class UserActivityController {
    @Resource
    private IUserActivityService service;

    @RequestMapping("/useractivitylist")
    public PageInfo<UserActivity> list(Integer pageNum){
        //分页
        if (pageNum==null)
            pageNum=1;
        Integer pageSize=12;
        //添加翻页page参数   ↓↓↓↓↓↓↓↓
        PageInfo<UserActivity> pageInfo = service.getUserActivitys(pageNum,pageSize);

        return pageInfo;
    }

    @RequestMapping("/deleteUAById")
    public int deleteByUserActivityId(int userActivityId){
        return service.deleteByUserActivityId(userActivityId);
    }

    @RequestMapping("/selectUactCount")
    public int selectUactCount(){
        return service.getselectUactCount();
    }

}
